<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form>
        <label for="stu_id">
            学号：<input type="text" name="" id="stu_id"><br>
        </label>
        <label for="stu_name">
            姓名：<input type="text" name="" id="stu_name"><br>
        </label>
        <label for="chinese">
            语文：<input type="text" name="" id="chinese"><br>
        </label>
        <label for="math">
            数学：<input type="text" name="" id="math"><br>
        </label>
        <label for="english">
            英语：<input type="text" name="" id="english"><br>
        </label>
        <label for="art">
            美术：<input type="text" name="" id="art"><br>
        </label>
    </form>
    <button class="btn_midterm_exam">学生期中考试信息提交</button>
    <script src="../../js/jquery-1.12.4.min.js"></script>
    <script>
        $('.btn_midterm_exam').click((e)=>{
            e.preventDefault(); //取消浏览器默认行为
            $.ajax({
                method:'post',
                url:'http://localhost:8080/midterm_exam',
                data:{
                    stu_id:$('#stu_id').val(),
                    stu_name:$('#stu_name').val(),
                    chinese:$('#chinese').val(),
                    math:$('#math').val(),
                    english:$('#english').val(),
                    art:$('#art').val()
                },
                success:(data)=>{
                    console.log(data);
                },
                error:(err)=>{
                    console.log(err);
                }
            })
        })
    </script>
</body>
</html>